<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta charset="utf-8" />
    <title>通知详情</title>
    <meta name="description" content="Draggabble Widget Boxes &amp; Containers" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

    <!-- bootstrap & fontawesome -->
    <link rel="stylesheet" href="assets/weui/dist/style/weui.min.css" />
    <!-- ace styles -->
    <link rel="stylesheet" href="assets/css/ace.css" class="ace-main-stylesheet" id="main-ace-style" />
</head>

<body class="no-skin">
<div class="weui_cells">
    <div class="weui_cell">
        <div><span th:text="${notificationbody}"/></div>
    </div>
    <div class="weui_cell">
        <div class="weui_cell_bd weui_cell_primary">
            <p>状态</p>
        </div>
        <div  class="weui_cell_ft">
            <p id="notificationstatus"><span th:text="${notificationstatus}"/></p>
        </div>
    </div>
</div>

<div class="space"></div>
<button id="checkin_btn" style="display: none" class="weui_btn weui_btn_primary">确认</button>
<div class="space"></div>


<!-- toast-->
<div id="toast_div" style="display: none;">
    <div class="weui_mask_transparent"></div>
    <div class="weui_toast">
        <i class="weui_icon_toast"></i>
        <p class="weui_toast_content">已确认</p>
    </div>
</div>
<!--toast-->

<!--DATA-->
<p id="openid_div" style="display: none" ><span th:text="${openid}"/></p>
<p id="notificationid_div" style="display: none" ><span th:text="${notificationid}"/></p>

<script src="assets/js/jquery.js"></script>
<script  type="text/javascript">
    $(document).ready(function(){
        InitStatus();
        $("#checkin_btn").click(function(){
            _notificationid=$("#notificationid_div").text();
            $.ajax({
                url: "notificationaccept",
                type: "POST",
                data: {notificationid: _notificationid},
                dataType: "json",
                async: false,
                success: function(data){
                    if (data.retcode == 0){
                        checkinBtnHide();
                        showOKToast();
                    }
                    else{
                        checkinBtnShow();
                    }
                }
            });
        });
    });
    
    function InitStatus() {
        if ($('#notificationstatus').text() == "yes") {
            checkinBtnHide();
        }
        else{
            checkinBtnShow();
        }
    }
    function checkinBtnShow(){
        $("#notificationstatus").html("未确认");
        $("#checkin_btn").show();
    }
    function checkinBtnHide(){
        $("#notificationstatus").html("已确认");
        $("#checkin_btn").hide();
    }
</script>
<script src="js/jinshan_weui.js"></script>

</body>
</html>
